 var id = getvl("id");
 
   $(function(){
   	   if(id!=''){
   	   	  dingdandaifukaun(id);
   	   }else{
   	   	//alert(".....失败");
   	   }
   });
 

function dingdandaifukaun(){	
	$("#shijian").val("");
     $.ajax({
			url: urlcore + "/api/order/selectOne2?id="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success:function(data){
				if(data.success == true) {
					
    $("#kuaidis").attr("href","12.8.5buy_dingdan_wuliu.html?orderNumber="+data.data.orderNumber);
				
				
			var dizhis=data.data.address.province+data.data.address.city+data.data.address.county+data.data.address.address;
			var dizhi=' <ul class="clearfix" style="width: 100%;"> '+
'<li><span>收&nbsp;&nbsp;货&nbsp;&nbsp;人</span>'+data.data.address.userName+'</li>'+
'        <li class="a_xiugai_right">'+
'            <span>电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话</span>'+data.data.address.userPhone+''+
'        </li>'+
'        <li><span>收货地址</span>'+dizhis+'</li>'+
'    </ul>';	
			   $("#dizhi").append(dizhi);//地址		
			   $("#pingjia").attr("href","12.8.4buy_dingdan_pingjia.html?id="+data.data.id);
			   
	   $("#shopnaem").html(data.data.shop.storeName);
	   var	leirong="";
	  // alert(JSON.stringify(data.data.goodsCarList));
			 $.each(data.data.goodsCarList,function(m,q){
			 leirong+='<div class="clearfix tuwen">'+
'    	<a href="../7.0.0goods_detail.html?id='+q.goods.id+'">'+
'	        <div class="tuwen-img fl">'+
'	            <img onerror="errorImg2(this)" src="'+q.goods.coverUrl+'" width="75" height="75">'+
'	        </div>'+
'	        <div class="tuwen-wenzi">'+
'	            <h5 class="wuye_h01">'+q.goods.goodsTitle+'</h5>'+
'	            <div class="wuye_div01">产品质量均有保障</div>'+
'	        </div>'+
'        </a>'+
'    </div>';


		 $.each(q.myStockList,function(y,n){
			leirong += ' <div class="dingdan_fenlei clearfix">' +
 								'    	<ul class="fl">' +
 								'    		<li>颜色：<span>'+n.colour.colourName+'</span></li>'+
'    		<li>尺码：<span>'+n.size.sizeName+'</span></li>'+
'    		<li>单价：<span>'+q.packRate+'元/件</span></li>'+'    	</ul>' +
 								'    	<div class="fr">' +
 								'    		<h5>' + ((q.packRate*n.saleNum).toFixed(2))+ '元</h5>' +
 								'    		<h6>' + n.saleNum + '件</h6>' +
 								'    	</div>' +
 								'    </div>';
			 });
			 });
			  if(data.data.remark!=null){
			  	 $("#liuyan").html(data.data.remark);
			  }
			  $("#shangshuliang").html(data.data.goodsNumber);
			   $("#heji").html("&yen;"+data.data.orderMoney);
			    var peisong="";
			    if(data.data.giveType==1){
			    	peisong="包邮";
			    }else if(data.data.giveType==2){
			    	peisong="快递";
			    }else if(data.data.giveType==3){
			    	peisong="物流到付";
			    }
			   $("#peisong").html(peisong);
			   
		var feiyongmingxi='<li>商品总金额<span>&yen;'+data.data.orderMoney+'</span></li>'+
'        <li>总运费<span>+&yen;'+data.data.freightMoney+'</span></li>'+
'        <li>优惠券<span>-&yen;'+data.data.saveMoney+'</span></li>'+
'        <li>金币抵扣<span>-&yen;'+data.data.goldMoney+'</span></li>';
    var fangshi="未支付";
           if(data.data.payType==1){
           	  fangshi="余额支付";
           }else if(data.data.payType==2){
           	 fangshi="支付宝支付";
           }else if(data.data.payType==3){
           	fangshi="微信支付";
           }else if(data.data.payType==4){
           	fangshi="银联支付";
           }
      var gmtDatetime = new Date(data.data.gmtDatetime).pattern("yyyy-MM-dd hh:mm:ss");
       var payTime = new Date(data.data.payTime).pattern("yyyy-MM-dd hh:mm:ss");
        var sendtime = new Date(data.data.sendTime).pattern("yyyy-MM-dd hh:mm:ss");
         var take = new Date(data.data.takeTime).pattern("yyyy-MM-dd hh:mm:ss");
 var dingdanxingxi='<li>订单编号<span>'+data.data.orderNumber+'</span></li>'+
 '<li>付款时间<sapn>'+payTime+'</sapn></li>'+
 '<li>发货时间<sapn>'+sendtime+'</sapn></li>'+
 '<li>收货时间<sapn>'+take+'</sapn></li>'+
 '  <li>付款方式<span>'+fangshi+'</span></li>'+
'<li>创建时间<span>'+gmtDatetime+'</span></li>';
   $("#shifujine").html("&yen;"+data.data.payMoney);    
	$("#feiyongmingxi").append(feiyongmingxi);//费用信息
    $("#dingdanxingxi").append(dingdanxingxi);//费用信息
	$("#neirong").append(leirong);
	dingdanbianhao(data.data.orderNumber);
			 }
			},
			error:function() {
				alert("error");
			}
		});
}




 function dingdanbianhao(orderNumber){
     $.ajax({
			url: urlcore + "/api/order/selectOrder?orderNumber="+orderNumber,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success:function(data){
				if(data.success == true) {
					var da=data.data;
					if(da.express!=null){
						 var kuaidiss='<h6>'+da.express.companyName+'</h6>'+
                     '<span>快递编号:'+da.express.expressNumber+'</span>';
						$("#kuaidiss").append(kuaidiss);
				/*	$("#kuaidi").text();
					$("#danhao").text();*/
					}
				
				}else{
					alert("异常");
				}
			},
			error:function() {
				alert("error");
			}
		});
 
 }